<template>
	<view class="transferhome">
		<view class="f15 px15 mt15 withdraw">
			<view>
				<view class="f14 sgrey">输入旧密码</view>
				<view class="enternumber px15 py15 por por mt10 flex">
					<input class="flex-1" type="text" :password="!logstate" placeholder="请输入旧安全密码"  v-model="originPsd">
					<view class="px5 flex" @click="eyesin('logstate')">
						<image :src="logstate?'../../static/user/eye2.png':'../../static/user/eye1.png'" class="eyes"></image>
					</view>
				</view>
				<view class="psdtip f12 sgrey mt30">
					设置新密码 (支持字母、数字和特殊字符，至少8位字符，包含字母大小写和数字组成)
				</view>
				<view class="enternumber px15 py15 por por mt10 flex">
					<input class="flex-1" :password="!passtate" type="text" placeholder="请输入安全密码"  v-model="newpassword">
					<view class="px5 flex" @click="eyesin('passtate')">
						<image :src="passtate?'../../static/user/eye2.png':'../../static/user/eye1.png'" class="eyes"></image>
					</view>
				</view>
				<view class="enternumber px15 py15 por por mt10 flex">
					<input class="flex-1" :password="!restate" type="text" placeholder="再次确认安全密码"  v-model="repass">
					<view class="px5 flex" @click="eyesin('restate')">
						<image :src="restate?'../../static/user/eye2.png':'../../static/user/eye1.png'" class="eyes"></image>
					</view>
				</view>
			</view>
			<view class="white flex-text f16 h44 lh1 btmbtn mb20" @click="submit">确定</view>
		</view>
	</view>
</template>

<script>
	import { mapState, mapActions } from 'vuex';
	export default {
		data() {
			return {
				originPsd:'',
				newpassword:'',
				repass:'',
				logstate:false,
				passtate:false,
				restate:false
			}
		},
		computed: {
			rule() {
				return [
					{ name: 'telphone', checkType: 'phone', checkRule: '', errorMsg: '请输入正确的接收用户手机号' },
					{ name: 'transfer', checkType: 'required', checkRule: '', errorMsg: '请输入转账数量' }
				]
			}
		},
		onLoad(options) {
		
		},
		methods:{
			eyesin(state){
				if(state=='logstate'){
					this.logstate=!this.logstate
				}else if(state=='passtate'){
					this.passtate=!this.passtate
				}else{
					this.restate=!this.restate
				}
			},
			submit:async function(e){
				let that = this
				let param = {
					symbol:'USDT',
					type:that.cointype,
					mobile :that.otherphone,
					number:that.transnumber,
					payPwd:that.$md5(e)
				}
				let headerUUid = that.randomString(Math.ceil(Math.random()*10))
				let validData =that.addQueryString(Object.assign({},param))
				validData+= '&secretKey=YLtwNzGIGq3EKFev'
				param.sign = that.$md5(validData)
				await that.$http.post('exchange.transfer', param, {isAuth:true,isId:true, header:{phoneUuid:headerUUid}, tipConfig: { isLoading: false } }).then(data=>{
					that.navigatePage('/pages/exchange/success?type=1', 'slide-in-right')
				}).catch(err => {
					// that.otherphone = ''
					// that.transnumber = ''
					that.$refs.payword.close()
					that.payShow = false
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.transferhome{
		padding: 50rpx 0;
		.sgrey{
			color: #828282;
		}
		.psdtip{
			line-height: 1.75;
		}
	
	
		.enternumber{
			background-color: #F5F6F7;
			color: #000;
			border-radius: 8rpx;
			.eyes{
				height: 36rpx;
				width: 36rpx;
			}
		}
	
		.btmbtn{
			margin-top:70rpx;
			background-color: #308AE4;
			border-radius: 14rpx;
		}
	}
</style>

